<template>
  <mt-tabbar v-model="selected">
    <mt-tab-item id="home">
      <img slot="icon" src="" />
      首页
    </mt-tab-item>
    <mt-tab-item id="info">
      <img slot="icon" src="" />
      消息
    </mt-tab-item>
    <mt-tab-item id="发现">
      <img slot="icon" src="" />
      发现
    </mt-tab-item>
    <mt-tab-item id="我的">
      <img slot="icon" src="" />
      我的
    </mt-tab-item>
  </mt-tabbar>
</template>

<script>
export default {
  name: "Tabber",
  data() {
    return {
      showtabbar: true, //是否显示tabbar
      selected: "",
    };
  },
  watch: {
    $route: {
      handler() {
        // const title = this.$route.meta.title;
        // const titleArr = ['首页','群聊'];
        // for(let i = 0; i<titleArr.length; i++){
        //   if(title == titleArr[i]){
        //     this.showtabbar = true;
        //   }else{
        //     this.showtabbar = false;
        //   }
        // }
        if (this.$route.meta.showtabbar) {
          this.showtabbar = true;
        } else {
          this.showtabbar = false;
        }
      },
    },
    selected(vul) {
      if (vul == "home") {
        this.$router.push("/home");
      } else if (vul == "info") {
        this.$router.push("/info");
        //console.log(this.$route);
      }
    },
  },
};
</script>

<style lang="scss" scoped>
</style>